package com.zone.gateway.center.interfaces;

import com.zone.gateway.center.application.IGatewayConfigManageService;
import com.zone.gateway.center.domain.manage.model.aggregate.ApplicationGatewayRichInfo;
import com.zone.gateway.center.domain.manage.model.entity.GatewayServerDetailEntity;
import com.zone.gateway.center.domain.manage.model.entity.GatewayServerEntity;
import com.zone.gateway.common.response.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: zongzi
 * @description: TODO
 * @date: 2025/4/24
 */
@RestController
@RequestMapping("/gateway/config/manage")
public class GatewayConfigManageController {
    @Autowired
    private IGatewayConfigManageService gatewayConfigManageService;

    @GetMapping("/query_gateway_server_list")
    public List<GatewayServerEntity> queryGatewayServerList() {
        return gatewayConfigManageService.queryGatewayServerList();
    }

    @PostMapping("/regis")
    public Boolean regis(@RequestBody GatewayServerDetailEntity gatewayServerDetail) {
        gatewayConfigManageService.regis(gatewayServerDetail);
        return true;
    }

    @GetMapping("query_application_rich_info")
    public ApplicationGatewayRichInfo queryApplicationRichInfo(String gatewayId) {
        return gatewayConfigManageService.queryApplicationRichInfo(gatewayId);
    }

    @GetMapping("/query_gateway_ids")
    public Result<List<String>> queryGatewayIds(@RequestParam String systemId) {
        List<String> gatewayIds = gatewayConfigManageService.queryGatewayIds(systemId);
        return Result.success(gatewayIds);
    }
}
